package com.luobo.web;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.luobo.entity.Guanka;
import com.luobo.entity.News;
import com.luobo.entity.Question;
import com.luobo.entity.Tujian;
import com.luobo.service.BuluoDao;

@Controller
@RequestMapping("buluo")
public class BuluoController {

	@Resource
	private BuluoDao buluoDao;
	
	/**
	 * 新闻的详细内容
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "news/{id}",method=RequestMethod.GET)
	public String detailOfNews(@PathVariable("id") Integer id,ModelMap map){
		News news = buluoDao.getNewsById(id);
		map.put("detail", news);
		return "detail";
	}
	@RequestMapping(value = "guanka/{id}",method=RequestMethod.GET)
	public String detailOfGonglve(@PathVariable("id") Integer id,ModelMap map){
		Guanka tujian = buluoDao.getGonglveById(id);
		map.put("detail", tujian);
		return "detail";
	}
	@RequestMapping(value = "video/{id}",method=RequestMethod.GET)
	public String detailOfVideo(@PathVariable("id") Integer id,ModelMap map){
		Guanka tujian = buluoDao.getVideoById(id);
		map.put("detail", tujian);
		return "video";
	}
	@RequestMapping(value = "tujian/{id}",method=RequestMethod.GET)
	public String detailOfTujian(@PathVariable("id") Integer id,ModelMap map){
		Tujian tujian = buluoDao.getTujianById(id);
		map.put("detail", tujian);
		return "detail";
	}
	@RequestMapping(value = "question/{id}",method=RequestMethod.GET)
	public String detailOfQuestion(@PathVariable("id") Integer id,ModelMap map){
		Question question = buluoDao.getQuestionById(id);
		map.put("detail", question);
		return "detail";
	}
}
